<template>
  <div style="padding:70px;">
    <div class="head">
      <div class="head-right">
        <router-link
          tag="span"
          active-class="activeClass"
          v-for="(item,index) in headoptions"
          :key="item.name"
          :index="index"
          :to="item.path"
        >{{item.name}}</router-link>
      </div>
    </div>
    <div style="padding-top:80px;width:100%;">
      <keep-alive>
          <router-view/>
      </keep-alive>
    </div>
  </div>
</template>

<script>
import AForm from "ant-design-vue/es/form/Form";
import ATabs from "ant-design-vue/es/tabs";
import GlobalFooter from "../../layouts/GlobalFooter";
import AFormItem from "ant-design-vue/es/form/FormItem";
import AInput from "ant-design-vue/es/input/Input";
import AIcon from "ant-design-vue/es/icon";
import AInputGroup from "ant-design-vue/es/input/Group";
import AButton from "ant-design-vue/es/button/button";
import ACol from "ant-design-vue/es/grid/Col";
import ARow from "ant-design-vue/es/grid/Row";
import ACheckbox from "ant-design-vue/es/checkbox/Checkbox";
import AAlert from "ant-design-vue/es/alert/index";
import api from "@/common/api";
const ATabPane = ATabs.TabPane;

export default {
  name: "Login",
  components: {
    AAlert,
    ACheckbox,
    ACol,
    ARow,
    AButton,
    AInputGroup,
    AIcon,
    AInput,
    AFormItem,
    GlobalFooter,
    ATabPane,
    ATabs,
    AForm
  },
  data() {
    return {
      formItemLayout: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 7 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 12 },
          md: { span: 10 }
        }
      },
      headoptions: [
        {
          path: "/org/safeset/modifyloginpw",
          name: "修改登录密码"
        },
        {
          path: "/org/safeset/modifypayindex",
          name: "修改支付密码"
        },
        // {
        //   path: "/org/safeset/modifysafe",
        //   name: "修改密保问题"
        // }
      ],
      name: "XXXXX有限公司",
      utime: "2019-05-17 14:06:47",
      memberNO: "1242353756857854",
      isSpe: false,
      userName: '',
      payPassword:sessionStorage.getItem("payPassword")
    };
  },
  watch: {},
  computed: {},
  mounted() {
    this.getInfo();
    if (this.payPassword) {
      this.headoptions[1].name = "修改支付密码"
    } else {
      this.headoptions[1].name = "设置支付密码"
    }
  },
  methods: {
    handleChange(value) {
      console.log(value);
    },
    gomanage(){
      this.$router.push('/org/accountmanage/myinfo');
    },
    getInfo() {
      let userName = localStorage.getItem("userName");
      if (userName) {
        this.userName = userName;
      }
      let data = {
        username: this.userName
      };
      api.getUserInfo(
        data,
        res => {
         
          if (res.code == "OK") {
            let mobileNo = res.data.mobileNo;
            let securityQuestion = res.data.securityQuestion;
            let userName = res.data.userName;
            let memberNo = res.data.memberNo;
            let email = res.data.email;
            localStorage.setItem("mobileNo", mobileNo);
            localStorage.setItem("securityQuestion", securityQuestion);
            localStorage.setItem("userName", userName);
            localStorage.setItem("memberNo", memberNo);
            localStorage.setItem("payemail", email);
          } else {
            this.$message.error(res.message);
          }
        },
        err => {}
      );
    },
  }
};
</script>

<style lang="less" scoped>
span {
  cursor: pointer;
}
li {
  list-style: none;
}
.head {
  /* height: 100px; */
  display: flex;
  align-items: center;
  /* padding: 0 50px; */
  /* position: relative; */
  align-items: center;
  /* justify-content: center; */
  justify-content: initial;
  .breadfont {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    a {
      color: #333;
    }
  }
}

.head-right {
  /* position: absolute;
  right: 100px; */
  span {
    font-size: 16px;
    font-weight: bold;
    color: #999;
    margin: 0 15px;
  }
  .activeClass {
    color: #333;
  }
}
</style>
